home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / AccessibleRole.java < prev    next >
Text File  |  1998-06-30  |  18KB  |  510 lines

  1. /*
  2.  * @(#)AccessibleRole.java    1.18 97/12/03
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.accessibility;
  22.  
  23. import java.util.Locale;
  24. import java.util.MissingResourceException;
  25. import java.util.ResourceBundle;
  26.  
  27. /**
  28.  * <P>Class AccessibleRole determines the role of a component.  The role of a 
  29.  * component describes the components generic function, such as
  30.  * "push button," "table," or "list."
  31.  * <p>The toDisplayString method allows you to obtain the localized string 
  32.  * for a locale independent key from a predefined ResourceBundle for the 
  33.  * keys defined in this class.
  34.  * <p>The constants in this class present a strongly typed enumeration
  35.  * of common object roles.  A public constructor for this class has been
  36.  * purposely omitted and applications should use one of the constants
  37.  * from this class.  If the constants in this class are not sufficient
  38.  * to describe the role of an object, a subclass should be generated
  39.  * from this class and it should provide constants in a similar manner.
  40.  *
  41.  * @version     1.18 12/03/97 14:49:26
  42.  * @author      Willie Walker
  43.  * @author    Peter Korn
  44.  */
  45. public class AccessibleRole extends AccessibleBundle {
  46.  
  47. // If you add or remove anything from here, make sure you 
  48. // update AccessibleResourceBundle.java.
  49.  
  50.     /**
  51.      * Object is used to alert the user about something.
  52.      */
  53.     public static final AccessibleRole ALERT               
  54.             = new AccessibleRole("alert");
  55.  
  56.     /**
  57.      * The header for a column of data.
  58.      */
  59.     public static final AccessibleRole COLUMN_HEADER
  60.             = new AccessibleRole("columnheader");
  61.  
  62.     /** 
  63.      * A list of choices the user can select from.  Also optionally 
  64.      * allows the user to enter a choice of their own.
  65.      */     
  66.     public static final AccessibleRole COMBO_BOX
  67.             = new AccessibleRole("combobox");
  68.  
  69.     /** 
  70.      * An iconified internal frame in a DESKTOP_PANE.
  71.      * @see #DESKTOP_PANE
  72.      * @see #INTERNAL_FRAME
  73.      */
  74.     public static final AccessibleRole DESKTOP_ICON
  75.             = new AccessibleRole("desktopicon");
  76.  
  77.     /** 
  78.      * A frame-like object that is clipped by a desktop pane.  The
  79.      * desktop pane, internal frame, and desktop icon objects are 
  80.      * often used to create multiple document interfaces within an
  81.      * application.
  82.      * @see #DESKTOP_ICON
  83.      * @see #DESKTOP_PANE
  84.      * @see #FRAME
  85.      */
  86.     public static final AccessibleRole INTERNAL_FRAME
  87.             = new AccessibleRole("internalframe");
  88.  
  89.     /**
  90.      * A pane that supports internal frames and 
  91.      * iconified versions of those internal frames.
  92.      * @see #DESKTOP_ICON
  93.      * @see #INTERNAL_FRAME
  94.      */
  95.     public static final AccessibleRole DESKTOP_PANE
  96.             = new AccessibleRole("desktoppane");
  97.  
  98.     /** 
  99.      * A top level window with no title or border.
  100.      * @see #FRAME
  101.      * @see #DIALOG
  102.      */
  103.     public static final AccessibleRole WINDOW
  104.             = new AccessibleRole("window");
  105.  
  106.     /**
  107.      * A top level window with a title bar, border, menu bar, etc.  It is
  108.      * often used as the primary window for an application.
  109.      * @see #DIALOG
  110.      * @see #WINDOW
  111.      */
  112.     public static final AccessibleRole FRAME
  113.             = new AccessibleRole("frame");
  114.  
  115.     /** 
  116.      * A top level window with title bar and a border.  A dialog is similar 
  117.      * to a frame, but it has fewer properties and is often used as a 
  118.      * secondary window for an application.
  119.      * @see #FRAME
  120.      * @see #WINDOW
  121.      */
  122.     public static final AccessibleRole DIALOG
  123.             = new AccessibleRole("dialog");
  124.  
  125.     /**
  126.      * A pane that allows the user to navigate through 
  127.      * and select the contents of a directory.  May be used
  128.      * by a file chooser.
  129.      * @see #FILE_CHOOSER
  130.      */
  131.     public static final AccessibleRole DIRECTORY_PANE
  132.             = new AccessibleRole("directorypane");
  133.  
  134.     /**
  135.      * A specialized dialog that displays the files in the directory
  136.      * and lets the user select a file, browse a different directory,
  137.      * or specify a filename.  May use the directory pane to show the
  138.      * contents of a directory.
  139.      * @see #DIRECTORY_PANE
  140.      */
  141.     public static final AccessibleRole FILE_CHOOSER
  142.             = new AccessibleRole("filechooser");
  143.  
  144.     /** 
  145.      * An object that fills up space in a user interface.  It is often
  146.      * used in interfaces to tweak the spacing between components,
  147.      * but serves no other purpose.
  148.      */
  149.     public static final AccessibleRole FILLER
  150.             = new AccessibleRole("filler");
  151.  
  152.     /** 
  153.      * An object used to present an icon or short string in an interface.
  154.      */
  155.     public static final AccessibleRole LABEL
  156.             = new AccessibleRole("label");
  157.  
  158.     /**
  159.      * A specialized pane that has a glass pane and a layered pane as its
  160.      * children.
  161.      * @see #GLASS_PANE
  162.      * @see #LAYERED_PANE
  163.      */
  164.     public static final AccessibleRole ROOT_PANE
  165.             = new AccessibleRole("rootpane");
  166.  
  167.     /**
  168.      * A pane that is guaranteed to be painted on top
  169.      * of all panes beneath it.
  170.      * @see #ROOT_PANE
  171.      */
  172.     public static final AccessibleRole GLASS_PANE
  173.             = new AccessibleRole("glasspane");
  174.  
  175.     /** 
  176.      * A specialized pane that allows its children to be drawn in layers,
  177.      * providing a form of stacking order.  This is usually the pane that
  178.      * holds the menu bar as well as the pane that contains most of the
  179.      * visual components in a window.
  180.      * @see #GLASS_PANE
  181.      * @see #ROOT_PANE
  182.      */
  183.     public static final AccessibleRole LAYERED_PANE
  184.             = new AccessibleRole("layeredpane");
  185.  
  186.     /**
  187.      * An object that presents a list of objects to user and allows the
  188.      * user to select one or more of them.  A list is usually contained
  189.      * within a scroll pane.
  190.      * @see #SCROLL_PANE
  191.      */
  192.     public static final AccessibleRole LIST
  193.             = new AccessibleRole("list");
  194.  
  195.     /**
  196.      * An object usually drawn at the top of the primary dialog box of
  197.      * an application that contains a list of menus the user can choose
  198.      * from.  For example, a menu bar might contain menus for "File,"
  199.      * "Edit," and "Help."
  200.      * @see #MENU
  201.      * @see #POPUP_MENU
  202.      * @see #LAYERED_PANE
  203.      */
  204.     public static final AccessibleRole MENU_BAR
  205.             = new AccessibleRole("menubar");
  206.  
  207.     /** 
  208.      * A temporary window that is usually used to offer the user a 
  209.      * list of choices, and then hides when the user selects one of
  210.      * those choices.
  211.      * @see #MENU
  212.      * @see #MENU_ITEM
  213.      */
  214.     public static final AccessibleRole POPUP_MENU
  215.             = new AccessibleRole("popupmenu");
  216.  
  217.     /** 
  218.      * An object usually contained in a menu bar that contains a list
  219.      * of actions the user can choose from.  A menu can have any object
  220.      * as its children, but most often they are menu items, other menus,
  221.      * or rudimentary objects such as radio buttons, check boxes, or
  222.      * separators.  For example, an application may have an "Edit" menu 
  223.      * that contains menu items for "Cut" and "Paste."
  224.      * @see #MENU_BAR
  225.      * @see #MENU_ITEM
  226.      * @see #SEPARATOR
  227.      * @see #RADIO_BUTTON
  228.      * @see #CHECK_BOX
  229.      * @see #POPUP_MENU
  230.      */    
  231.     public static final AccessibleRole MENU
  232.             = new AccessibleRole("menu");
  233.  
  234.     /**
  235.      * An object usually contained in a menu that presents an action 
  236.      * the user can choose.  For example, the "Cut" menu item in an
  237.      * "Edit" menu would be an action the user can select to cut the
  238.      * selected area of text in a document.
  239.      * @see #MENU_BAR
  240.      * @see #SEPARATOR
  241.      * @see #POPUP_MENU
  242.      */
  243.     public static final AccessibleRole MENU_ITEM
  244.             = new AccessibleRole("menuitem");
  245.  
  246.     /**
  247.      * An object usually contained in a menu to provide a visual
  248.      * and logical separation of the contents in a menu.  For example,
  249.      * the "File" menu of an application might contain menu items for
  250.      * "Open," "Close," and "Exit," and will place a separator between
  251.      * "Close" and "Exit" menu items.
  252.      * @see #MENU
  253.      * @see #MENU_ITEM
  254.      */
  255.     public static final AccessibleRole SEPARATOR
  256.             = new AccessibleRole("separator");
  257.  
  258.     /**
  259.      * An object that presents a series of panels (or page tabs), one at a 
  260.      * time, through some mechanism provided by the object.  The most common 
  261.      * mechanism is a list of tabs at the top of the panel.  The children of
  262.      * a page tab list are all page tabs.
  263.      * @see #PAGE_TAB
  264.      */
  265.     public static final AccessibleRole PAGE_TAB_LIST
  266.             = new AccessibleRole("pagetablist");
  267.  
  268.     /**
  269.      * An object that is a child of a page tab list.  Its sole child is
  270.      * the panel that is to be presented to the user when the user 
  271.      * selects the page tab from the list of tabs in the page tab list.
  272.      * @see #PAGE_TAB_LIST
  273.      */
  274.     public static final AccessibleRole PAGE_TAB
  275.             = new AccessibleRole("pagetab");
  276.  
  277.     /**
  278.      * A generic container that is often used to group objects.
  279.      */
  280.     public static final AccessibleRole PANEL
  281.             = new AccessibleRole("panel");
  282.  
  283.     /**
  284.      * An object used to indicate how much of a task has been completed.
  285.      */
  286.     public static final AccessibleRole PROGRESS_BAR
  287.             = new AccessibleRole("progressbar");
  288.  
  289.     /**
  290.      * A text object used for passwords, or other places where the 
  291.      * text contents is not shown visibly to the user
  292.      */
  293.     public static final AccessibleRole PASSWORD_TEXT
  294.             = new AccessibleRole("passwordtext");
  295.  
  296.     /**
  297.      * An object the user can manipulate to tell the application to do
  298.      * something.
  299.      * @see #CHECK_BOX
  300.      * @see #TOGGLE_BUTTON
  301.      * @see #RADIO_BUTTON
  302.      */
  303.     public static final AccessibleRole PUSH_BUTTON
  304.             = new AccessibleRole("pushbutton");
  305.   
  306.     /**
  307.      * A specialized push button that can be checked or unchecked, but
  308.      * does not provide a separate indicator indicating the current state.
  309.      * @see #PUSH_BUTTON
  310.      * @see #CHECK_BOX
  311.      * @see #RADIO_BUTTON
  312.      */
  313.     public static final AccessibleRole TOGGLE_BUTTON
  314.             = new AccessibleRole("togglebutton");
  315.  
  316.     /**
  317.      * A choice that can be checked or unchecked and provides a 
  318.      * separate indicator indicating the current state.
  319.      * @see #PUSH_BUTTON
  320.      * @see #TOGGLE_BUTTON
  321.      * @see #RADIO_BUTTON
  322.      */
  323.     public static final AccessibleRole CHECK_BOX
  324.             = new AccessibleRole("checkbox");
  325.  
  326.     /**
  327.      * A specialized check box that will cause other radio buttons in the
  328.      * same group to become unchecked when this one is checked.  
  329.      * @see #PUSH_BUTTON
  330.      * @see #TOGGLE_BUTTON
  331.      * @see #CHECK_BOX
  332.      */
  333.     public static final AccessibleRole RADIO_BUTTON
  334.             = new AccessibleRole("radiobutton");
  335.  
  336.     /**
  337.      * The header for a row of data.
  338.      */
  339.     public static final AccessibleRole ROW_HEADER
  340.             = new AccessibleRole("rowheader");
  341.  
  342.     /**
  343.      * An object that allows a user to incrementally view a large amount
  344.      * of information.  Its children can include scroll bars and a viewport.
  345.      * @see #SCROLL_BAR
  346.      * @see #VIEWPORT
  347.      */
  348.     public static final AccessibleRole SCROLL_PANE
  349.             = new AccessibleRole("scrollpane");
  350.  
  351.     /** 
  352.      * An object usually used to allow a user to incrementally view a
  353.      * large amount of data.  Usually used only by a scroll pane.
  354.      * @see #SCROLL_PANE
  355.      */
  356.     public static final AccessibleRole SCROLL_BAR
  357.             = new AccessibleRole("scrollbar");
  358.  
  359.     /**
  360.      * An object usually used in a scroll pane.  It represents the portion 
  361.      * of the entire data that the user can see.  As the user manipulates 
  362.      * the scroll bars, the contents of the viewport can change.
  363.      * @see #SCROLL_PANE
  364.      */
  365.     public static final AccessibleRole VIEWPORT
  366.             = new AccessibleRole("viewport");
  367.  
  368.     /**
  369.      * An object that allows the user to select from a bounded range.  For
  370.      * example, a slider might be used to select a number between 0 and 100.
  371.      */    
  372.     public static final AccessibleRole SLIDER
  373.             = new AccessibleRole("slider");
  374.  
  375.     /**
  376.      * A specialized panel that presents two other panels at the same time.
  377.      * Between the two panels is a divider the user can manipulate to make
  378.      * one panel larger and the other panel smaller.
  379.      */
  380.     public static final AccessibleRole SPLIT_PANE
  381.             = new AccessibleRole("splitpane");
  382.  
  383.     /**
  384.      * An object used to present information in terms of rows and columns.
  385.      * An example might include a spreadsheet application.
  386.      */
  387.     public static final AccessibleRole TABLE
  388.             = new AccessibleRole("table");
  389.  
  390.     /**
  391.      * An object that presents text to the user.  The text is usually
  392.      * editable by the user as opposed to a label.
  393.      * @see #LABEL
  394.      */
  395.     public static final AccessibleRole TEXT
  396.             = new AccessibleRole("text");
  397.  
  398.     /**
  399.      * An object used to present hierarchical information to the user.
  400.      * The individual nodes in the tree can be collapsed and expanded
  401.      * to provide selective disclosure of the tree's contents.
  402.      */
  403.     public static final AccessibleRole TREE
  404.             = new AccessibleRole("tree");
  405.  
  406.     /**
  407.      * A bar or palette usually composed of push buttons or toggle buttons.
  408.      * It is often used to provide the most often used functions for an
  409.      * application.
  410.      */
  411.     public static final AccessibleRole TOOL_BAR
  412.             = new AccessibleRole("toolbar");
  413.  
  414.     /** 
  415.      * An object that provides information about another object.  The 
  416.      * accessibleDescription property of the tool tip is often displayed 
  417.      * to the user in a small "help bubble" when the user causes the 
  418.      * mouse to hover over the object associated with the tool tip.
  419.      */
  420.     public static final AccessibleRole TOOL_TIP
  421.             = new AccessibleRole("tooltip");
  422.  
  423.     /**
  424.      * An AWT component, but nothing else is known about it.
  425.      * @see #SWING_COMPONENT
  426.      * @see #UNKNOWN
  427.      */
  428.     public static final AccessibleRole AWT_COMPONENT
  429.             = new AccessibleRole("awtcomponent");
  430.  
  431.     /**
  432.      * A Swing component, but nothing else is known about it.
  433.      * @see #AWT_COMPONENT
  434.      * @see #UNKNOWN
  435.      */
  436.     public static final AccessibleRole SWING_COMPONENT
  437.             = new AccessibleRole("swingcomponent");
  438.  
  439.     /**
  440.      * The object contains some Accessible information, but its role is
  441.      * not known.
  442.      * @see #AWT_COMPONENT
  443.      * @see #SWING_COMPONENT
  444.      */
  445.     public static final AccessibleRole UNKNOWN
  446.             = new AccessibleRole("unknown");
  447.  
  448. // The following are all under consideration for potential future use.
  449.  
  450. //    public static final AccessibleRole APPLICATION
  451. //            = new AccessibleRole("application");
  452.  
  453. //    public static final AccessibleRole BORDER
  454. //            = new AccessibleRole("border");
  455.  
  456. //    public static final AccessibleRole CHECK_BOX_MENU_ITEM
  457. //            = new AccessibleRole("checkboxmenuitem");
  458.  
  459. //    public static final AccessibleRole CHOICE
  460. //            = new AccessibleRole("choice");
  461.  
  462. //    public static final AccessibleRole COLUMN
  463. //            = new AccessibleRole("column");
  464.  
  465. //    public static final AccessibleRole CURSOR
  466. //            = new AccessibleRole("cursor");
  467.  
  468. //    public static final AccessibleRole DOCUMENT
  469. //            = new AccessibleRole("document");
  470.  
  471. //    public static final AccessibleRole GROUPING
  472. //            = new AccessibleRole("grouping");
  473.  
  474. //    public static final AccessibleRole IMAGE
  475. //            = new AccessibleRole("image");
  476.  
  477. //    public static final AccessibleRole INDICATOR
  478. //            = new AccessibleRole("indicator");
  479.  
  480. //    public static final AccessibleRole LIST_ITEM
  481. //            = new AccessibleRole("listitem");
  482.  
  483. //    public static final AccessibleRole RADIO_BUTTON_MENU_ITEM
  484. //            = new AccessibleRole("radiobuttonmenuitem");
  485.  
  486. //    public static final AccessibleRole ROW
  487. //            = new AccessibleRole("row");
  488.  
  489. //    public static final AccessibleRole TABLE_CELL
  490. //        = new AccessibleRole("tablecell");
  491.  
  492. //    public static final AccessibleRole TREE_NODE
  493. //            = new AccessibleRole("treenode");
  494.  
  495.     /**
  496.      * Create a new AccessibleRole using the given locale independent key.
  497.      * This should not be a public method.  Instead, it is used to create
  498.      * the constants in this file to make it a strongly typed enumeration.
  499.      * Subclasses of this class should enforce similar policy.
  500.      * @param key the locale independent name of the role.
  501.      * @note The String should be a locale independent key for the role.
  502.      * It is not intended to be used as the actual String to display 
  503.      * to the user.  To get the localized string, use toDisplayString.
  504.      * @see AccessibleBundle#toDisplayString
  505.      */
  506.     protected AccessibleRole(String key) {
  507.         this.key = key;        
  508.     }
  509. }
  510.